Skip to content

Small fix and some cleaning in nondet-static [TG-2755] #2874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2018

Conversation

majakusber
Copy link

Fixing a small bug - adding a label to not nondet-initialize a Java internal variable, pulls out a function to make it available outside of the files and adds missing documentation.

This label is recognized by nondet-static option
@majakusber majakusber force-pushed the nondet_static_condition branch from 15423ea to d97e9ff Compare August 31, 2018 13:10
@@ -18,6 +18,44 @@ Date: November 2011

#include <linking/static_lifetime_init.h>

/// Returns true if the symbol expression holds a static symbol that can be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be in \return ?

/// Nondeterministically initializes certain global scope variables in
/// CPROVER_initialize function.
/// \param ns Namespace for resolving type information.
/// \param goto_functions Existing goto-functions to be updated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also mark [out]

@@ -49,7 +49,13 @@ bool is_nondet_initializable_static(
!is_constant_or_has_constant_components(ns.lookup(id).type, ns);
}


/// Nondeterministically initializes certain global scope variables in a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault but "certain" is very vague 🌵

@@ -93,6 +99,10 @@ void nondet_static(
}
}

/// Nondeterministically initializes certain global scope variables in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌵

@@ -18,6 +18,38 @@ Date: November 2011

#include <linking/static_lifetime_init.h>

/// Returns true if the symbol expression holds a static symbol that can be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ ⛏️ "that" -> "which"

@tautschnig
Copy link
Collaborator

Wishlist request: the PR title claims a bug is being fixed (and I think it's the first of the three commits doing so) - could a test be added that showcases the problem/works now while it didn't work before? It's perfectly possible that this can only be tested in some other code base such as TG and you might have a test in there, then all is well. Else I'd ask for a test to be added somewhere.

@majakusber
Copy link
Author

@tautschnig Yes, the first commit is the bug fix. I needed to make this change because under the changes in my PR https://github.com/diffblue/test-gen/pull/2219 one of the regression tests is failing without it, namely compile-java-tests/return-value-is-parameter. I'm not entirely sure why that test is failing but not others.

All of the changes here actually came out of the work in https://github.com/diffblue/test-gen/pull/2219. I have a separate test-gen pointer bump for this so that I don't have to wait until all review comments are addressed on https://github.com/diffblue/test-gen/pull/2219.

@majakusber majakusber force-pushed the nondet_static_condition branch from d97e9ff to 4d0e23b Compare September 3, 2018 10:43
Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small suggestion regarding a comment, but not going to block this PR just for that.

if(!ns.get_symbol_table().has_symbol(id))
return false;

// any other internal variable such as Java specific?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the comment be better saying something like "is the type explicitly marked as not to be nondet initialized?" I assume other language front-ends could conceivably also want to mark some types in the same way, so it might be nice not to make this sound too Java centric.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree - this is not necessarily Java specific.

if(!ns.get_symbol_table().has_symbol(id))
return false;

// any other internal variable such as Java specific?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree - this is not necessarily Java specific.

Module: Nondeterministic initialization of certain global scope
variables
Module: Nondeterministically initializes global scope variables, except for
constants (such as string literals, final fields) and internal variables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the detailed description to the doxygen below.

svorenova added 2 commits September 3, 2018 15:19
@majakusber majakusber force-pushed the nondet_static_condition branch from 4d0e23b to 8230504 Compare September 3, 2018 14:33
@majakusber majakusber merged commit 8000a2f into diffblue:develop Sep 3, 2018
@majakusber majakusber deleted the nondet_static_condition branch September 3, 2018 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants